{oapdf_gg}
Microsoft Office office suite with its powerful, convenient and practical and are widely used. Word of the software as the most popular word processing software format of Word documents become the de facto document exchange standard. Format for Word documents on the current popularity of the reality of paper, if their own word-processing software (or similar software) does not support the Word document format that is almost unimaginable that such software can not be dealt with as a result is bound to account for a considerable proportion of the Word document file without being recognized by the user. Therefore, when such software development, adding to the Word document file format support is essential. This article will discuss this topic. Add a type library to the project Add in the application of the Word there are many ways to support, but no more than the following two types: one is to prepare their own code or using third-party developers provide packages of support for the realization of the Word; the other is directly in the process Word provide a variety of external function calls and interfaces to achieve the same purpose in support of Word. Before a method of relatively large workload, and whether in the functionality or reliability difficult to achieve the same level with the Word. The latter method is to take some kind of practical technical means to support the functions of Word documents to the Word software to complete, so that clearly can be achieved with the same Word document on the Word document the level of support. With this type of methods, such as DDE or COM technology to realize, this article through COM automation technology in the Word through a variety of external functions to provide interface support for Word documents. Such an approach can be as little as possible the occupation of automated customer resources, and does not require the type of object being accessed information can call on. Specific implementation is given below. Word processing software is usually taken to process a single document or the document structure, in order to use Word to provide the COM components, to establish the needs of the application package containers, so use the AppWizard to create a new MFC AppWizard (EXE) project, select Single Document View (SDI) or multiple document view (MDI) structure, and in step 3 to select Container, the container to provide support. The other can take the default option. ClassView will produce in the following categories: Application type: CEmbed_WordApp in Embed_Word.h and Embed_Word.cpp Framework of categories: CMainFrame in MainFrm.h and MainFrm.cpp Document type: CEmbed_WordDoc in Embed_WordDoc.h and Embed_WordDoc.cpp View class: Embed_WordView in Embed_WordView.h and Embed_WordView.cpp Vessel type: CEmbed_WordCntrItem in CntrItem.h and CntrItem.cpp Then add the Word type library to the project. In the View menu select ClassWizard sub-menu, from the pop-up dialog box, click the Automation tab of Add Class button and select From a TypeLibrary and select the Office directory Microsoft Word 97/2000 or Word8.olb type library Word9.olb, This will be the type of all types of libraries to add to your project. At this time, ClassView will be more than dozens of categories, can be provided through these types of interfaces to achieve the support of the Word document. |